/**
 * 
 */
var req = null;
var READY_STATE_UNINITIALIZED = 0;
var READY_STATE_LOADING = 1;
var READY_STATE_LOADED = 2;
var READY_STATE_INTERACTIVE = 3;
var READY_STATE_COMPLETE = 4;
var NO_ERROR = 0;
var HAVE_ERROR = 1;
var ERROR = -1;
var isMSIE = navigator.userAgent.toUpperCase().indexOf("MSIE") == -1 ? false : true;
$(document).ready(function(){
	$("#commstatus").hide();
});
$("#commswitch").click(function(){
	$.ajax({
		type: 'post',
		url: this.name + "comm.action?commstatus=" + $("#commstatus").text(),
		success: function(data){
			var json = eval("(" + data + ")");
			if(!json.open)
			{
				$("#commswitch")[0].name = "open";
				$("#commswitch")[0].value = "打开串口";
				$("#commstatusdesc")[0].innerHTML = "已关闭";
			}else
			{
				$("#commswitch")[0].name = "close";
				$("#commswitch")[0].value = "关闭串口";
				$("#commstatusdesc")[0].innerHTML = "已打开";
			}
		}
	});
});